<template>
    <div class="home">
        <Header/>
        <Sidebar/>
        <div class="content-box" :class="{'content-collapse':collapse}">
            <Tags/>
            <div class="content">
                <transition name="move" mode="out-in">
                    <router-view/>
                </transition>
            </div>
        </div>
    </div>
</template>

<script>
    import Header from 'components/Header'
    import Sidebar from 'components/Sidebar'
    import Tags from 'components/Tags'
    import Bus from 'common/js/bus'
    export default {
        name: "home",
        data(){
            return {
                collapse:false,
                tagsList:[]
            }
        },
        components:{
            Header,
            Sidebar,
            Tags
        },
        created(){
            Bus.$on('collapse', msg => {
                this.collapse = msg;
            });

            Bus.$on('tags',msg=>{
                let arr = [];
                for(let i=0,len=msg.length;i < len;i++){
                    msg[i].name && arr.push(msg[i].name);
                }
                this.tagsList = arr;
            })
        }
    }
</script>

<style scoped>

</style>